package com.easy.west.westclient.api.meeting.api;

import android.content.Context;
import android.support.annotation.NonNull;

import com.easy.west.westclient.api.base.bean.SuccessBean;
import com.easy.west.westclient.api.base.callback.BaseCallBack;
import com.easy.west.westclient.api.base.impl.BaseImpl;
import com.easy.west.westclient.api.meeting.bean.MeetRoomList;
import com.easy.west.westclient.api.meeting.bean.OrderedMeetingBean;
import com.easy.west.westclient.api.meeting.event.FindMeetingRoomLsitEvent;
import com.easy.west.westclient.api.meeting.event.FindOrderdMeetingEvent;
import com.easy.west.westclient.api.meeting.event.OrederCompleteEvnet;
import com.easy.west.westclient.util.UUIDGenerator;

import retrofit2.Call;

/**
 * 会议接口实现
 * Created by xiatao on 2018/8/20.
 */

public class MeetingImpl extends BaseImpl<MeetingService> implements MeetingApi{
    public MeetingImpl(@NonNull Context context) {
        super(context);
    }

    /**
     * 注释见接口
     * @param selectdate 时间
     * @param selecttime 时区范围
     * @param size 大小
     * @param vip 是否是vip
     * @return
     */
    @Override
    public String findMeetingRoomBy(String selectdate, int selecttime, int size, boolean vip) {
        String uuid = UUIDGenerator.getUUID();
        service.findMeetingRoomBy(selectdate,selecttime,size,vip).enqueue(new BaseCallBack<MeetRoomList>(new FindMeetingRoomLsitEvent(uuid)));
        return uuid;
    }


    /***
     *
     * @param mrid 会议室id
     * @param title 会议标题
     * @param selectdate 会议室预约日期
     * @param selecttime 会议开始时间段
     * @param uid 用户id
     * @param departmentid 用户部门id
     * @param number 参会人数
     * @param leader 参会领导
     * @param starttime 会议开始时间
     * @param sit_card 座牌内容
     * @param meeting_flag 会标内容
     * @param ispravite 是否保密
     * @param privatereason 保密原因
     * @param equipment 设备及需求
     * @return
     */
    @Override
    public String orderMeeting(long mrid, String title, String selectdate, int selecttime, long uid, long departmentid, int number, String leader, String starttime, String sit_card, String meeting_flag, boolean ispravite, String privatereason, String equipment
    ,String phone,String u_name) {
        String uuid = UUIDGenerator.getUUID();
        service.orderMeeting(mrid
        ,title,selectdate,selecttime,uid,departmentid,number,leader,starttime,sit_card,meeting_flag,ispravite,privatereason
        ,equipment,phone,u_name).enqueue(new BaseCallBack<SuccessBean>(new OrederCompleteEvnet(uuid)));
        return uuid;
    }

    @Override
    public String findorderedMeet(int mrid) {
        String uuid = UUIDGenerator.getUUID();
        service.findorderedMeeting(mrid).enqueue(new BaseCallBack<OrderedMeetingBean>(new FindOrderdMeetingEvent(uuid)));
        return uuid;
    }

}
